#include <iostream>
using namespace std;
 class Complex {
      private:double real;
	double image;
      public:Complex(double r = 0, double i = 0) {
		real = r;
		image = i;
	};
	void setValue(double r, double i) {
		real = r;
		image = i;
	};
	void multiply(double r, double i);
	void addValue(double r, double i);
	void displayMessage();
};

 void Complex::multiply(double r, double i) 
{
	double new_real = real * r - image * i;
	double new_image = real * i + image * r;
	real = new_real;
	image = new_image;
}  void Complex::addValue(double r, double i) 
{
	real += r;
	image += i;
}  void Complex::displayMessage() 
{
	if (real != 0 || image == 0) {
		cout << real;
	}
	if (real != 0 && image > 0) {
		cout << "+";
	}
	if (image != 0) {
		if (image == 1)
			cout << "i";
		
		else if (image == -1)
			cout << "-i";
		
		else
			cout << image << "i";
	}
	cout << endl;
}

int main(void) 
{
	Complex a(4.9, -1);
	a.displayMessage();
	a.addValue(1, 1);
	a.displayMessage();
	a.setValue(0, 1);
	a.displayMessage();
	a.multiply(0, 2);
	a.displayMessage();
	return 0;
}


